﻿using Calligraphy.CalligraphyData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Calligraphy.DataModel
{
    partial class PaperPhotoesDataSource
    {
        T_StelePaper _stelePaper;

        public void LoadPaperPhotoes(T_StelePaper stelePaper)
        {
            _stelePaper = stelePaper;
            var q = from pp in DataServiceContextHelper.DataContext.T_PaperPhoto.Expand("T_StelePaper").Expand("T_Photo") where pp.StelePaperID == stelePaper.ID && (pp.IsDeleted == null || pp.IsDeleted == false) orderby pp.PageNumber ascending select pp;
            stelePaper.T_PaperPhoto.LoadAsync(q);
        }

        public static  void LoadPaperPhotoesByPaperPhoto(T_PaperPhoto paperPhoto)
        {
            var q = from pp in DataServiceContextHelper.DataContext.T_PaperPhoto.Expand("T_StelePaper").Expand("T_Photo") where pp.StelePaperID == paperPhoto.T_StelePaper.ID && (pp.IsDeleted == null || pp.IsDeleted == false) orderby pp.PageNumber ascending select pp;
            paperPhoto.T_StelePaper.T_PaperPhoto.LoadAsync(q);
        }
    }
}
